package com.zyong.design.pattern.strategy.case1;

/**
 * @program: zyong-design-pattern
 * @ClassName: Context
 * @author: zyong
 * @create: 2024-04-14 00:20
 */
public class Context {
    private Strategy strategy;

    public Context(Strategy strategy) {
        this.strategy = strategy;
    }

    /**
     * 设置策略实现类
     * @param strategy
     */
    public void setStrategy(Strategy strategy) {
        this.strategy = strategy;
    }

    public void operate() {
        strategy.operate();
    }
}
